<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>固定定位</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .parent{
            width: 500px;
            height: 2500px;
            background-color: burlywood;
        }
        .child{
            width: 100px;
            height: 100%;
            background-color: rgba(0 0 0);
            position: fixed;
            left: 0;
            top: 0;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child"></div>
        <p>你好</p>
     </div>
</body>
</html>